classdef dotsDrawableArcs < dotsDrawable
    % @class dotsDrawableArcs
    % Draw one or multiple arcs at once.
    % @details
    % dotsDrawableArcs uses an OpenGL utility ("GLU") to approximate arcs
    % which fall along the circumference of a circle.
    %
    % @ingroup drawable
    
    properties (SetObservable = true)
        % x-coordinate for the center of each arc's circle (degrees visual
        % angle, centered)
        x = 0;
        
        % y-coordinate for the center of each arc's circle (degrees visual
        % angle, centered)
        y = 0;
        
        % radius of each arc's circle (degrees visual angle)
        radius = 5;
        
        % width of each arc about its circle's circumference (degrees
        % visual angle)
        width = 1;
        
        % where each arc starts along its circle (degrees
        % counterclockwise from rightward)
        startAngle = 0;
        
        % how far each arc sweeps along its circle (degrees
        % counterclockwise from rightward)
        sweepAngle = 45;
        
        % the color of all arcs ([RGB]), or a color for each arc ([RGB;
        % RGB; etc])
        color = [255 255 255];
        
        % the number segments along the sweep of all arcs, or a number for
        % each arc
        nSlices = 10;
        
        % the number rings within the width of all arcs, or a number for
        % each arc
        nLoops = 1;
        
        % whether or not to smooth the edges of arcs (logical)
        smooth = false;
    end
    
    methods
        % Constructor takes no arguments.
        function self = dotsDrawableArcs
            self = self@dotsDrawable;
            self.color = self.foregroundColor;
        end
        
        % Draw one or more arcs at once.
        function draw(self)
            inside = self.radius - self.width/2;
            outside = self.radius + self.width/2;
            clockwiseFromUpward = 90-self.startAngle;
            clockwiseSweep = -self.sweepAngle;
            
            dotsMglSmoothness('polygons', double(self.smooth));
            mglGluPartialDisk( ...
                self.x, ...
                self.y, ...
                inside, ...
                outside, ...
                clockwiseFromUpward, ...
                clockwiseSweep, ...
                self.color, ...
                self.nSlices, ...
                self.nLoops);
        end
    end
end